package com.liugege.make.singleton;

public class SingletonDemo3 {
    private  static  volatile SingletonDemo3 singletonDemo3 ;

    private  SingletonDemo3(){

    }
    public   static  SingletonDemo3 getInstance(){
        if (singletonDemo3 == null){
            synchronized (SingletonDemo3.class){
                if (singletonDemo3 == null){
                   singletonDemo3 = new SingletonDemo3();
                }
            }
        }
        return singletonDemo3;
    }

    public static void main(String[] args) {
        SingletonDemo3 instance = SingletonDemo3.getInstance();
        SingletonDemo3 instance1 = SingletonDemo3.getInstance();
        System.out.println(instance == instance1);
    }
}
